package com.sjy.ylxt.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ResponseEnum {
    /**
     * 成功类型
     */
    SUCCESS(0, "操作成功", 1),
    /**
     * 某些外部接口要求操作成功返回200
     */
    SUCCESS_200(200, "success", 0),
    /**
     * 默认失败类型
     */
    FAILED(-1, "系统异常", 0),
    /**
     * 常规校验或业务校验异常
     */
    BUSINESS_FAILED(400, "业务校验异常", 0),
    ;

    private final Integer code;
    private final String msg;
    private final int successCode;

    public boolean isSuccess() {
        return this.successCode == 1;
    }
}
